mod commands;

use std::env;

fn main() {
    let args: Vec<String> = env::args().collect();

    if args.len() < 2 {
        eprintln!("使用方法: {} <命令> [参数...]", args[0]);
        return;
    }

    let command = &args[1];
    let command_args = &args[2..];

    match command.as_str() {
        "cp" => commands::file_ops::cp::execute(command_args),
        "ls" => commands::file_ops::ls::execute(command_args),
        "mv" => commands::file_ops::mv::execute(command_args),
        "pwd" => commands::file_ops::pwd::execute(),
        "rm" => commands::file_ops::rm::execute(command_args),
        "tail" => commands::file_ops::tail::execute(command_args),
        "touch" => commands::file_ops::touch::execute(command_args),
        "wget" => commands::file_ops::wget::execute(command_args),
        "mkdir" => commands::directory_ops::mkdir::execute(command_args),
        "cat" => commands::text_ops::cat::execute(command_args),
        "top" => commands::system_ops::top::execute(command_args),
        "kill" => commands::system_ops::kill::execute(command_args),
        _ => eprintln!("未知命令: {}", command),
    }
}
